import Cookies from 'js-cookie'

const state = {
  // 对账信息  当前是在对哪个医院 哪个月 哪天的账
  recDVo: Cookies.get('recDVo')?JSON.parse(Cookies.get('recDVo')):''
};

const mutations = {
  SET_RECDVO: (state, recDVo) => { 
    state.recDVo = recDVo;
    Cookies.set('recDVo', JSON.stringify(recDVo));
  }
};

const actions = {
  setRecDVo({ commit },recDVo) {
    return  new Promise((resolve, reject) => {
      try{
        commit('SET_RECDVO',recDVo)
        resolve()
      }catch (e) {
        reject(e)
      }
    });
  }
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
